#ifndef MSGHANDLER_H
#define MSGHANDLER_H
#include "protocol.h"
#include <QString>
#include <QFile>

class MyTcpSocket;
class MsgHandler
{
public:
    //用于上传文件的属性
    QFile m_fUploadFile;
    bool m_bUpload;
    qint64 m_iUploadTotal;
    qint64 m_iUploadReceived;

    //用于下载文件的属性
    bool m_bDownload;
    QFile m_fDownloadFile;

    MsgHandler();
    PDU* handleRegist(PDU* pdu);
    PDU* handleLogin(PDU* pdu,QString& LoginName);
    PDU* handleFindUser(PDU* pdu);
    PDU* handleOnlineUser();
    PDU* handleAddFriend(PDU* pdu);
    PDU* handleAddFriendAgree(PDU* pdu);
    PDU* handleOnlineFriend(PDU* pdu);
    PDU* handleDelFriend(PDU* pdu);
    void handleChat(PDU* pdu);
    PDU* handleMKDIR(PDU* pdu);
    PDU* handleFlushFile(PDU* pdu);
    PDU* handleDelDir(PDU* pdu);
    PDU* handleRenameFile(PDU* pdu);
    PDU* handleDelFile(PDU* pdu);
    PDU* handleMoveFile(PDU* pdu);
    PDU* handleUploadFile(PDU* pdu);
    PDU* handleUploadFileData(PDU* pdu);
    PDU* handleDownloadFile(PDU* pdu);
    PDU* handleDownloadFileData(MyTcpSocket* socket);
    PDU* handleShareFile(PDU* pdu);
    PDU* handleShareFileAgree(PDU* pdu);
    bool copyDir(QString strSrcDir, QString strDestDir);
};

#endif // MSGHANDLER_H
